//
//  BlockDemoViewController.m
//  TestIos
//
//  Created by HsDev on 2025/1/20.
//  Copyright © 2025 Liyadong. All rights reserved.
//

/*
 声明
返回值类型(^block变量名)(参数列表)
int(^personBlock)(NSString *,int)
返回值类型:int
block变量名: personBlock
参数列表:NSString *,int
(注意:参数列表只需要写参数类型,不需要写参数名,例如:NSString * name 的写法是不对的,不需要写参数名name)
 
//使用别名的方式声明一个block
typedef void(^ PersonBlock) (int,NSString *);
 */


/*
 实现
 返回值类型(^block变量名)(参数列表) = ^(参数列表) {
  
 };
 以上Block的声明“=” 前面的“参数列表”只需要写参数类型,不需要写参数名.
 “=”后面的 “参数列表” 则需要写参数类型+参数名,
 例如:
 NSString * (^personBlock)(NSString *,int) = ^(NSString * name, int age){
      NSLog(@"年龄==%d",age);
      return name;
 };
 //调用
 NSString * name = personBlock(@"zhangsan",29);
 */

#import "BlockDemoViewController.h"

@interface BlockDemoViewController ()

@end

@implementation BlockDemoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor greenColor];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
